<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>03_版心与居中</title>
    <style>
      .main{
        background-color: lightblue;
      }
      .card{
          width: 300px;
          height: 400px;
          border: 5px solid #000;
          background-color: lightsalmon;
          /*文字居中*/
          text-align: center;
          /*设置行高与卡片一样高，让卡片里的文字垂直居中*/
          line-height: 400px;
          /*让块级元素自己，也就是卡片本身在版心里居中*/
          margin: 0 auto;
      }
      .center{
          background-color: lightgreen;
          width: 1000px;
          margin: 0 auto;
      }
    </style>
</head>
<body>
  <div class="header">111</div>
  <div class="main">
    <div class="center">
      <div class="card">我是内容</div>
      <div class="card">我是内容</div>
    </div>
  </div>
  <div class="footer">333</div>
</body>
</html>